var faqCtrl  = new XFApp.client();
XFApp.client.prototype.faq = {
	successCode : "10000",
	urlItems : {
		modifyURL : basePath+"/faq/submit"
	},
	
	subFaq:function(){
		
		var _this = this;
		var id = $("#id").val();
		var title = $("#title").val();
		var question = $("#question").val();
		var answer = $("#answer").val();
		if(!title || !question || !answer){
			webDialogUtil.simpleAlert("请输入必要字段", "温馨提示");
			return ;
		}
		var params = {
				id:id,
				title:title,
				question:question,
				answer:answer
		}
		
		webDialogUtil.simpleConfrimAlert("是否确认提交？", function(){
			$.ajax({
				url : _this.urlItems.modifyURL,
				dataType : 'json',
				data  : params,
				type : 'post',
				success : function(data) {
					if(data.code!=10000){
						webDialogUtil.simpleAlert(data.msg, "温馨提示");
					}else{
						webDialogUtil.simpleAlert("处理成功", "温馨提示");
					}
				},
				error:function(){
					webDialogUtil.simpleAlert("处理异常，请联系开发人员", "温馨提示");
				}
			});
		}, null, "温馨提示");
	},
	event : function(){
		var _this = this;
		$("#sub_btn").on("click",function(){
			_this.subFaq();
		});
	},
};
$(function(){
	faqCtrl.faq.event();
});